<?php
// http://pear.php.net/manual/en/package.http.http-request2.intro.php
require_once 'HTTP/Request2.php';
function determineVersionPolitienl() {

  $request = new HTTP_Request2('http://www.politie.nl/_version', HTTP_Request2::METHOD_GET, ["connect_timeout"=>1]);
  $request->setHeader(["User-Agent"=>"PHP narrowcast"]);
  try {
    $response = $request->send();
    if (200 == $response->getStatus()) {
      return json_decode($response->getBody())->versions;
    } else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase();
    }
  } catch (HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
  return null;
}
?>
